// packageA/pages/operator/bagDetail/bagDetail.js
const { imgPath } = require('../../../../utils/request')
const { request } = require('../../../../utils/request');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgPath: imgPath,
    activeNames: ['1'],
    bagId: '',
    timeLine: [],
    bagInfo: {
      bagId: '',
      accountName: '',
      accountId: '',
      money: '',
      actualMoney: '',
      abstract: '',
      date: ''
    },
    options: {
      '0': {
        text: '待银行接收',
        content: '订单已生成，待银行接收后进行清点',
        imgUrl: imgPath + '/bagdetWaitbank.png'
      },
      '1': {
        text: '待银行入账',
        content: '清点情况：真币xx，假币xx',
        imgUrl: imgPath + '/bagdetWaitaccount.png'
      },
      // '2': {
      //   text: '待银行入账',
      //   content: '清点发现假币，清点金额xx，假币金额xx，差额xx',
      //   imgUrl: imgPath + '/bagdetWaitaccount.png'
      // },
      // '3': {
      //   text: '待银行入账',
      //   content: '清点金额xx，差额xx', // 差额大按清点金额入账，差额小按原金额入账
      //   imgUrl: imgPath + '/bagdetWaitaccount.png'
      // },
      '4': {
        text: '银行已入账',
        content: '入账金额xx',
        imgUrl: imgPath + '/bagdetAccounted.png'
      },
      // '5': {
      //   text: '待银行退回',
      //   content: '经双方沟通确认，款项将退回站点',
      //   imgUrl: imgPath + '/bagdetWaitaccount.png'
      // },
      '6': {
        text: '银行退回',
        content: '经双方沟通确认，款项将退回站点，请注意查收',
        imgUrl: imgPath + '/bagdetReturn.png'
      },
      'A': {
        text: '申请作废中',
        content: '提交箱包作废申请',
        imgUrl: imgPath + '/bagdetWaitaccount.png'
      },
      'B': {
        text: '申请作废成功',
        content: '箱包已作废',
        imgUrl: imgPath + '/bagdetWaitaccount.png'
      }
    },
  },
  onChange(event) {
    this.setData({
      activeNames: event.detail,
    });
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: '箱包详情'
    })
    this.setData({ bagId: options.bagId })
    this.fetchBagInfo()
  },
  /**
   * 获取箱包详情
   */
  fetchBagInfo() {
    request('/smsk/wechat/baginfo/detail', 'GET', { bagId: this.data.bagId }).then(res => {
      console.log(res.data)
      if (res.data.code == 0) {
        this.setData({ bagInfo: res.data.data })
      } else {
        console.log(res.data)
        wx.showToast({
          title: res.data.message,
          icon: 'none'
        })
      }
    })
  }
})